<?php

	require_once('../scripts/query/vocabulary.php');

	function link_to_pictures($fight) {
	
		$left_file = '../scripts/res/' . str_replace(" ","_",$_SESSION['left_concept']) . '_' . $fight . '_img.txt';
		$right_file = '../scripts/res/' . str_replace(" ","_",$_SESSION['right_concept']) . '_' . $fight . '_img.txt';
	
		$l_values = file($left_file);
		$r_values = file($right_file);

		$index_dim = 0;
		
		// Case where the fight is about colors
		if($fight == "color") {
			foreach (vocabulary::$colors as $dim) {
				// Loading left images
				$t_values =  preg_split('/\t/',$l_values[$index_dim]);
				$_SESSION['l_' . $dim] = $t_values;
				
				// Loading right images
				$t_values =  preg_split('/\t/',$r_values[$index_dim]);
				$_SESSION['r_' . $dim] = $t_values;
				$index_dim ++;
			}
		}
		
		// Case where the fight is about emotions
		else if($fight == "emotion") {
			foreach (vocabulary::$emotions as $dim) {
				// Loading left images
				$t_values =  preg_split('/\t/',$l_values[$index_dim]);
				$_SESSION['l_' . $dim] = $t_values;
				
				// Loading right images
				$t_values =  preg_split('/\t/',$r_values[$index_dim]);
				$_SESSION['r_' . $dim] = $t_values;

				$index_dim ++;
			}
		}
		
		unlink($left_file);
		unlink($right_file);
	}

?>